<?php

namespace App\Console\Commands;

use App\Config\QueueConfig;
use App\Http\Library\Queue;
use Illuminate\Console\Command;

class PfsHeadQueryWithdrawProvisionPeople extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'job:pfs_head_queryWithdrawProvision_people';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '在脚本中指定监管账户和金额后人为触发调用：备份金退费借回';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $data = [
            'pfs_dw_id'       => 5,
            /*申请提款金额,这里必须是负数（轧差金额）*/
            'account_netting' => '-1.00',
            /*申请日期*/
            'create_date'     => '2021-08-31',
            /*人为调用*/
            'origin'          => 'people',
        ];
        var_dump($data);
        $name = $this->choice('确定要触发当前监管账户备份金调用?', ['yes' => '调用备份金接口', 'qut' => '退出'], 'qut');
        if ($name !== 'yes') {
            return $this->info('退出');
        }
        Queue::rpush($data, QueueConfig::PFS_HEAD_WITHDRAWPROVISION);
        $this->info('任务已推入队列');
        return 0;
    }
}
